<?php

namespace App\Http\Controllers\User;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Auth;
use App\Models\RegUser;
use App\Models\Register;
class BaseController extends Controller
{
    protected $user;

    public function __construct()
    {
        if(empty(Auth::user())){
            abort(403,'登录信息错误');
        }
        $user = Auth::user()->comuser();
        if(empty($user)){
            abort(403,'登录信息错误');
        }
        $this->user = $user;
        $this->corpid = $user->corpid;
    }

    public function formatJson($status='200',$msg='没有更多数据',$data=array(),$redirectUrl = '')
    {
        $result = array(
            'status'        => $status,
            'msg'           => $msg,
            'data'          => $data,
            'redirectUrl'   => $redirectUrl
        );
        return Response::json($result);
    }
}
